import javax.naming.*;
import java.io.File;
import java.util.Hashtable;

class Lookup {
    public static void main(String[] args) {
	Hashtable env = new Hashtable(11);
	env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
	env.put(Context.PROVIDER_URL, "file:/temp/tutorial");

	try {
	    // Create the initial context
	    Context ctx = new InitialContext(env);

	    // Perform lookup and cast to target type
	    File f = (File) ctx.lookup("report.txt");

	    System.out.println(f);

	    // Close the context when we're done
	    ctx.close();
	} catch (NamingException e) {
	    System.out.println("Lookup failed: " + e);
	}
    }
}
